package lib.gui;

import java.io.File;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

import lib.Base.Education;
import lib.Common.Cast;
import lib.Common.Path;

import org.swixml.SwingEngine;

public class GuiProfileEducation {
	/**
	 * Class which represents an educational entry in the profile page
	 */
	private JLabel name;
	private JLabel dateBegin;
	private JLabel dateEnd;

	public GuiProfileEducation(Education education) {
		
		//Render xml document
		try {
			new SwingEngine(this).render(new File(Path.GUI_PATH + "gui-profile-education.xml")).setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}

		this.name.setText(education.getName());
		this.dateBegin.setText(Cast.formatTimeStampAs_ddmmyyyy(education
				.getBegin()));
		this.dateEnd.setText(Cast
				.formatTimeStampAs_ddmmyyyy(education.getEnd()));

	}
	
	public JComponent getPanel(){
		return (JPanel)name.getParent();
	}
}